import React from 'react';
import ShowType from './showType'
import { connect } from 'react-redux'
import { addCount } from "../store/actions";
// import { getList } from '../api'
class App extends React.Component {
  add = () => {
    this.props.dispatch(addCount())
    // getList().then(data => {
    //   console.log(data)
    //   this.props.dispatch(addCount(data.length))
    // })
  }
  render() {
    return <div className=''>
      <button onClick={this.add}>++</button>
      <h1>{this.props.num}</h1>
      <ShowType />
    </div>;
  }
}
App = connect((state) => {
  return {
    // 把这个对象传给当前组件 使用
    num: state.A.count
  }
}, dispatch => {
  return {
    dispatch
  }
})(App)
export default App